package net.huashitong.ssydt.provider.task.controller;


import net.huashitong.ssydt.PaginationResult;
import net.huashitong.ssydt.provider.task.service.SsTaskCardService;
import net.huashitong.ssydt.security.utils.Result;
import net.huashitong.ssydt.task.entity.SsTaskCard;
import net.huashitong.ssydt.task.vo.SsTaskCardQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2018.01.15
 */
@RestController
@RequestMapping("/task/cards")
public class SsTaskCardController {

    private SsTaskCardService service;

    @Autowired
    public SsTaskCardController(SsTaskCardService service) {
        this.service = service;
    }

    @GetMapping("/{id}")
    public SsTaskCard selectByPrimaryKey(@PathVariable("id") Long id) {
        return this.service.selectByPrimaryKey(id);
    }

    @GetMapping
    public PaginationResult<SsTaskCard> list(@ModelAttribute SsTaskCardQueryVO queryVO) {
        return this.service.list(queryVO);
    }

    @DeleteMapping("/{id}")
    public Result<String> deleteWithUpdateQuestionCard(@PathVariable("id") Long id) {
        return this.service.deleteWithUpdateQuestionCard(id);
    }

    @PostMapping
    public Result<String> saveWithUpdateQuestionCard(@RequestBody SsTaskCard record) {
        return this.service.saveWithUpdateQuestionCard(record);
    }

    @PutMapping
    public Result<String> updateWithUpdateQuestionCard(@RequestBody SsTaskCard record) {
        return this.service.updateWithUpdateQuestionCard(record);
    }


}
